package com.gzsxy.lesson01.url;

import jdk.nashorn.internal.ir.CallNode;

import java.net.MalformedURLException;
import java.net.URL;

public class URLDemo01 {
    public static void main(String[] args) throws MalformedURLException {
        URL url = new URL("http://localhost:8080");
        System.out.println(url.getProtocol()); //协议http
        System.out.println(url.getHost()); //主机localhost
        System.out.println(url.getPort()); //端口8080
        System.out.println(url.getPath());//文件
        System.out.println(url.getFile());//全路径
        System.out.println(url.getQuery());//参数


    }

}
